//
//  CheckCardUtils.h
//  PokerHandUp
//
//  Created by psvn047 on 6/22/12.
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//

#import <Foundation/Foundation.h>
typedef enum
{
    kHighCard = 1,
    kPair = 2,
    kTwoPair = 3,
    kThreeOfAKind = 4,
    kStraight = 5,
    kFlush = 6,
    kFullHouse = 7,
    kFourOfAKind = 8,
    kStraightFlush = 9,
    kRoyalFlush = 10
} RankBestHand;
typedef enum
{
    rCompareWin = 1,
    rCompareLose = 2,
    rCompareEqual=3
} ResultCompareCards;
@interface BestCardsInfo : NSObject
{
    NSArray* bestCards;
    RankBestHand rankBestHank;
}
@property(nonatomic,assign) NSArray* bestCards;
@property(nonatomic,assign) RankBestHand rankBestHank;
-(ResultCompareCards) compareBestCard:(BestCardsInfo*) bestCardsInfo;
-(NSString*) debugBestHand;
@end

@interface StatisticCards : NSObject
{
    NSMutableArray* twoCards;
    NSMutableArray* threeCards;
    NSMutableArray* fourCards;
    NSMutableArray* fiveCards;
    NSMutableArray* sixCards;
    NSMutableArray* sevenCards;
    NSMutableArray* eightCards;
    NSMutableArray* nineCards;
    NSMutableArray* tenCards;
    NSMutableArray* jackCards;
    NSMutableArray* queenCards;
    NSMutableArray* kingCards;
    NSMutableArray* aceCards;
    
    NSMutableArray* clubCards;
    NSMutableArray* spadeCards;
    NSMutableArray* diamondCards;
    NSMutableArray* heartCards;
    
    NSMutableArray* fullCards;
    
}
@property(nonatomic,assign) NSMutableArray* twoCards;
@property(nonatomic,assign) NSMutableArray* threeCards;
@property(nonatomic,assign) NSMutableArray* fourCards;
@property(nonatomic,assign) NSMutableArray* fiveCards;
@property(nonatomic,assign) NSMutableArray* sixCards;
@property(nonatomic,assign) NSMutableArray* sevenCards;
@property(nonatomic,assign) NSMutableArray* eightCards;
@property(nonatomic,assign) NSMutableArray* nineCards;
@property(nonatomic,assign) NSMutableArray* tenCards;
@property(nonatomic,assign) NSMutableArray* jackCards;
@property(nonatomic,assign) NSMutableArray* queenCards;
@property(nonatomic,assign) NSMutableArray* kingCards;
@property(nonatomic,assign) NSMutableArray* aceCards;

@property(nonatomic,assign) NSMutableArray* clubCards;
@property(nonatomic,assign) NSMutableArray* spadeCards;
@property(nonatomic,assign) NSMutableArray* diamondCards;
@property(nonatomic,assign) NSMutableArray* heartCards;

@property(nonatomic,assign) NSMutableArray* fullCards;

-(void) parseCards:(NSArray*) array;
@end

@interface CheckCardUtils : NSObject
+ (NSArray*) checkFlush: (NSArray*) array;
+ (NSArray*) checkStraight: (NSArray*) array;
+ (NSArray*) checkStraightFlush: (NSArray*) array;
+ (NSArray*) checkRoyalFlush: (NSArray*) array;
+ (NSArray*) checkFourOfAKind: (StatisticCards*) statCards;
+ (NSArray*) checkFullHouse: (StatisticCards*) statCards;
+ (NSArray*) checkThreeOfAKind: (StatisticCards*) statCards;
+ (NSArray*) checkTwoPair: (StatisticCards*) statCards;
+ (NSArray*) checkPair: (StatisticCards*) statCards;
+ (NSArray*) checkHighCard: (NSArray*) array rank:(int) rank;
+ (NSArray*) checkMaxCard: (StatisticCards*) statCards rank:(int) rank except:(NSArray*) except;
+ (NSArray*) sortRankCards: (NSArray*) array ascending:(BOOL) isAscending;
+ (NSArray*) sortSuitCards: (NSArray*) array ascending:(BOOL) isAscending;

+(BestCardsInfo*)checkBestCard:(NSArray*) array;

+(void) debugCards:(NSArray*) array;
+(void) debugCards:(NSArray*) array tips:(NSString*) tips;
@end

